package com.hw01.controller;

import com.hw01.common.Result;
import com.hw01.service.EmployeeService;
import com.hw01.vo.LoginUserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

// 登录
@RestController
@Api("登录")
public class LoginController {

    @Autowired
    EmployeeService employeeService;

    @GetMapping("/login")
    @ApiOperation("用户登录")
    @ResponseBody
    public Result<LoginUserVo> login(@ApiParam(value = "登录用户名", required = true) String loginName
            , @ApiParam(value = "密码", required = true) String password) {

        return employeeService.login(loginName, password);
    }

    @GetMapping("/loginWeb")
    @ApiOperation("用户登录")
    @ResponseBody
    public Result<LoginUserVo> loginWeb(@ApiParam(value = "登录用户名", required = true) String loginName
            , @ApiParam(value = "密码", required = true) String password) {

        return employeeService.loginWeb(loginName, password);
    }

}
